package me.caofeng.service.api;

import com.sun.org.apache.regexp.internal.RE;
import com.sun.org.apache.regexp.internal.RESyntaxException;
import me.caofeng.pojo.*;

import javax.naming.spi.ResolveResult;
import java.util.List;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.service.api
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-15 20:06
 * @Version: V1.0
 */
public interface IUserService {

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/15 21:35
     * @Description:  用户注册
     * @return true 注册成功，false注册失败
    */
    Response<User> register(User user);


    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/16 9:39
     * @Description: 判断用户是否已经注册
     * @return true  已经注册，false没有注册
    */
    Response isRegister(String phone);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/16 19:37
     * @Description:  登录
    */
    Response<User> login(String phone ,String password);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 14:50
     * @Description: 获取用户信息，不含密码
    */
    Response<User> getUserInfo(String uid);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 17:39
     * @Description: 添加安全问题
    */
    Response addSecurityQuestions(QuestionForm questionForm,String userId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 18:13
     * @Description: 获取用户所有的安全问题
    */
    Response<List<SecurityQuestion>> getSecurityQuestions(String userId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 22:04
     * @Description: 更新用户名
     * @return  返回新的用户信息
    */
    Response<User> updateUserName(User user,String name);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 23:59
     * @Description: 更新用户密码
    */
    Response updatePassword(String password,String userId);

    Response updatePhone( SmsCode smsCode,String userId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/17 23:59
     * @Description: 获取用户设置的安全问题
    */
    Response<SecurityQuestion> getSecurityQuestion(Integer id,String userId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/18 0:00
     * @Description: 更新用户的安全问题
    */
    Response<SecurityQuestion> updateSecurityQuestion(Integer id,SecurityQuestion question,String userId);

    Response resetPassword(String password,String confirm,String token);

    Response<List<SecurityQuestion>> getQuestion(String phone);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/19 20:19
     * @Description: 验证用户提交的答案
     * @param answer 答案详情
     * @param phone 手机号
     * @param id 问题编号
    */
    Response verifyQuestion(String answer, String phone , Integer id);
}
